The present invention relates to a transmission device and a transmission method, a recording medium, a program, and a control device, and particularly to a transmission device and a transmission method, a recording medium, a program, and a control device for transmitting packets.
With the spread of the Internet, real-time application programs for videoconferencing, IP (Internet Protocol) telephones and the like have come into use. When these real-time application programs are used, a communication apparatus stores data such as video, audio and the like in packets, and transmits the packets storing the data to a terminal device on a receiving side via a network or the Internet.
FIG. 1 is a block diagram showing a configuration of functions implemented by a packet transmitting communication apparatus calling an application program and functions of a kernel of an operating system.
Data specified to be transmitted by a user in an application layer 11 is supplied from the application layer 11 to a network layer 12. In the network layer 12, the data supplied from the application layer 11 is stored in a packet. The packet storing the data is supplied to a device driver 14-1 or a device driver 14-2 determined by the destination (transmission destination) of the packet by referring to a routing table 13 in the network layer 12.
The routing table 13 includes information indicating an address of a terminal device (communication device) connected to a network and a route (gateway) to the terminal device on the network and the Internet. Hence, when the terminal device as the transmission destination of the packet is identified, the route to the terminal device is determined. Thereby an output interface for processing the packet to be transmitted is determined. The packet is thus supplied to the device driver 14-1 or the device driver 14-2 corresponding to the output interface.
The device driver 14-1 and the device driver 14-2 control a physical device (a physical layer 16-1 or a physical layer 16-2). The device driver 14-1 and the device driver 14-2 have a function of synchronizing processes between an OS (Operating System) and the physical device (the physical layer 16-1 or the physical layer 16-2).
An input processing unit 31-1 of the device driver 14-1 stores the packet supplied to the device driver 14-1 in a buffer 15, and disposes the packet in a FIFO (First In First Out) queue. When an interrupt signal indicating that packet transmission in the physical layer 16-1 is completed is supplied from the physical layer 16-1 to the device driver 14-1, an output processing unit 32-1 of the device driver 14-1 obtains the packet stored in the buffer 15 in order of arrangement in the FIFO queue, and supplies the packet to the physical layer 16-1.
In the physical layer 16-1, the packet supplied to the physical layer 16-1 is converted into an electric signal for communication, and the electric signal is transmitted to the terminal device as the transmission destination of the packet via the network or the Internet.
Similarly, an input processing unit 31-2 of the device driver 14-2 stores the packet supplied to the device driver 14-2 in the buffer 15, and disposes the packet in another FIFO queue. When an interrupt signal indicating that packet transmission in the physical layer 16-2 is completed is supplied from the physical layer 16-2 to the device driver 14-2, an output processing unit 32-2 of the device driver 14-2 obtains the packet stored in the buffer 15 in order of arrangement in the FIFO queue, and supplies the packet to the physical layer 16-2.
In the physical layer 16-2, the packet supplied to the physical layer 16-2 is converted into an electric signal for communication, and the electric signal is transmitted to the terminal device as the transmission destination of the packet via the network or the Internet.
This communication apparatus does not perform, for example, adjustment of transmission intervals of packets transmitted to a terminal device via the network or the Internet. Therefore, when the real-time application program supplies a packet from the application layer 11 to the network layer 12 by burst transfer, the physical layer 16-1 or the physical layer 16-2 transmits the packet to the terminal device as a transmission destination by burst transfer.
When the real-time application program is used, however, data (packet) transfer with little delay is required. The communication apparatus on a transmitting side therefore needs to avoid occurrence of so-called burst traffic, which results from burst transfer of data on the network or the Internet, by adjusting intervals at which packets are transmitted.
That is, as Sally Floyd describes, burst traffic is a factor in causing many undesirable situations such for example as global synchronization in which periods of detection of congestion in terminal devices, decrease in a band in use, and increase in the band in use are synchronous with each other, an unexpected packet loss, and increase in delay in data transfer between the terminal devices. In order to avoid such situations, the communication apparatus (terminal device) on a transmitting side needs traffic shaping technology, which controls an amount of traffic (see Sally Floyd and Van Jacobson, “Random Early Detection Gateways for Congestion Avoidance,” IEEE/ACM Transactions on Networking Vol. 1 No. 4, August, 1993).
Accordingly, control of an amount of traffic in a device driver is proposed. However, since there are as many device drives as kinds of network cards or hardware (chips) used therein, to directly add a function of traffic shaping to the device drivers would require an enormous amount of work.
As a method for solving this problem, Alan Cox proposes, in Simple Traffic Shaper disclosed in Red Hat (trademark) distribution of Linux (trademark), a method of controlling an amount of traffic, in which method a virtual output interface is considered and a corresponding virtual device driver (hereinafter referred to as a virtual device driver) is provided.
FIG. 2 is a block diagram showing a functional configuration of a communication apparatus that controls an amount of traffic in a virtual device driver. Incidentally, in the figure, parts corresponding to those in FIG. 1 are identified by the same reference numerals, and description thereof will be omitted as appropriate.
In a network layer 51, data supplied from an application layer 11 is stored in a packet. A route on the Internet which route is determined by a destination (transmission destination) of the packet is set by referring to a routing table 52, and the packet is supplied to a virtual device driver 53.
Specifically, when the data (packet) supplied from the application layer 11 to the network layer 51 is transmitted via a device driver 56-1 or a device driver 56-2, a virtual output interface not shown in the figure is set as an output interface determined by the destination of the packet. The packet to be transmitted is supplied to the virtual device driver 53 corresponding to the virtual output interface.
An input processing unit 71 of the virtual device driver 53 stores the packet supplied to the virtual device driver 53 in a buffer 55, and disposes the packet in a FIFO queue. An output processing unit 72 of the virtual device driver 53 obtains the packet stored in the buffer 55 at a predetermined time interval, and supplies the packet to the device driver 56-1 or the device driver 56-2.
That is, each time an interrupt signal to obtain a packet is supplied from a kernel timer 54, the output processing unit 72 of the virtual device driver 53 obtains the packet from the buffer 55 at a predetermined time interval, and supplies the obtained packet to the device driver 56-1 or the device driver 56-2.
An input processing unit 73-1 of the device driver 56-1 stores the packet supplied to the device driver 56-1 in the buffer 55. When an interrupt signal indicating that packet transmission in a physical layer 16-1 is completed is supplied from the physical layer 16-1 to the device driver 56-1, an output processing unit 74-1 of the device driver 56-1 obtains the packet stored in the buffer 55, and supplies the packet to the physical layer 16-1.
Similarly, an input processing unit 73-2 of the device driver 56-2 stores the packet supplied to the device driver 56-2 in the buffer 55. When an interrupt signal indicating that packet transmission in a physical layer 16-2 is completed is supplied from the physical layer 16-2 to the device driver 56-2, an output processing unit 74-2 of the device driver 56-2 obtains the packet stored in the buffer 55, and supplies the packet to the physical layer 16-2.
A packet enqueueing process by the virtual device driver 53 will be described with reference to a flowchart of FIG. 3.
Each time a packet is supplied from the network layer 51 to the virtual device driver 53, the virtual device driver 53 calls a predetermined function, and performs a packet enqueueing process.
In step S11, the virtual device driver 53 sets a maximum queue length for packets to be stored in the buffer 55. For example, in step S11, the virtual device driver 53 sets “5” as the maximum queue length Qm for packets to be stored in the buffer 55. The maximum queue length Qm refers to a maximum number of packets that can be stored in the buffer 55. Hence, when “5” is set as the maximum queue length Qm, the buffer 55 can store up to five packets.
In step S12, the virtual device driver 53 sets the queue length of packets stored in the buffer 55. In this case, no packet is stored in the buffer 55, and therefore the virtual device driver 53 sets “0” as the packet queue length Q. The queue length Q refers to the number of packets stored in the buffer 55.
In step S13, the virtual device driver 53 sets a stored packet number. The stored packet number refers to the packet number of a last stored packet among packets stored in the buffer 55 by the virtual device driver 53. When a packet is supplied from the network layer 51 to the virtual device driver 53, the virtual device driver 53 attaches a packet number i for identifying each packet to the supplied packet. The packet number is attached in ascending order starting with “1.” Incidentally, when the packet number i is “0,” the packet number indicates that no packet is supplied to the virtual device driver 53 yet.
Thus, in this case, no packet is stored in the buffer 55, and therefore the virtual device driver 53 sets “0” as the stored packet number.
In step S14, the input processing unit 71 in the virtual device driver 53 obtains a packet from the network layer 51.
In step S15, the input processing unit 71 in the virtual device driver 53 determines whether the queue length Q is less than the maximum queue length Qm. In this case, the input processing unit 71 in the virtual device driver 53 determines whether the queue length Q is less than the maximum queue length Qm by calculating Equation (1) and determining whether the queue length Q and the maximum queue length Qm satisfy Equation (1).Q<Qm  (1)
Hence, when the queue length Q is “1” and the maximum queue length Qm is “5,” for example, the queue length Q and the maximum queue length Qm satisfy Equation (1), and therefore it is determined that the queue length Q is less than the maximum queue length Qm.
When it is determined in step S15 that the queue length Q is not less than the maximum queue length Qm, the buffer 55 cannot store a packet any more. Thus, the process proceeds to step S16, where the input processing unit 71 in the virtual device driver 53 discards the packet obtained from the network layer 51. The process returns to step S14.
When it is determined in step S15 that the queue length Q is less than the maximum queue length Qm, on the other hand, the buffer 55 can store the packet. Thus, the process proceeds to step S17, where the input processing unit 71 in the virtual device driver 53 attaches a packet number i to the packet supplied from the network layer 51.
In step S18, the input processing unit 71 in the virtual device driver 53 performs a transmission time calculating process. While details of the transmission time calculating process will be described later, the input processing unit 71 in the virtual device driver 53 in the transmission time calculating process calculates the transmission time of the packet supplied from the network layer 51. The transmission time of the packet refers to a time at which the packet is transmitted to a terminal device as a transmission destination in the physical layer 16-1 or the physical layer 16-2.
In step S19, the input processing unit 71 in the virtual device driver 53 increments the stored packet number.
In step S20, the input processing unit 71 in the virtual device driver 53 enqueues the packet supplied from the network layer 51. Enqueueing refers to a process of disposing a packet in a FIFO queue (a queueing process). Specifically, in step S20, the input processing unit 71 in the virtual device driver 53 supplies the packet obtained from the network layer 51 to the buffer 55. The packet supplied from the virtual device driver 53 is stored in the buffer 55, and disposed in a FIFO queue.
In step S21, the input processing unit 71 in the virtual device driver 53 increments the queue length Q. The process then returns to step S14 to repeat the above-described process.
With reference to a flowchart of FIG. 4, description will be made of a transmission time calculating process corresponding to the process of step S18 in FIG. 3 when a Leaky Bucket algorithm (see J. S. Turner, “New Directions in Communications (or Which Way to the Information Age),” IEEE Communication Magazine Vol. 24 pp. 8-15, October, 1986) is used as a scheduling algorithm.
In step S41, the input processing unit 71 in the virtual device driver 53 determines whether the packet number i of the packet supplied from the network layer 51 is “0.”
When the input processing unit 71 in the virtual device driver 53 determines in step S41 that the packet number i of the packet supplied from the network layer 51 is not “0,” the process proceeds to step S42, where the input processing unit 71 in the virtual device driver 53 calculates the transmission time of the packet supplied from the network layer 51. In this case, the input processing unit 71 in the virtual device driver 53 calculates the transmission time of the packet by calculating Equation (2).(Ti)=(T(i−1))+(L(i−1))/r  (2)where Ti is the transmission time of the packet having the packet number i; T(i−1) is the transmission time of a packet having a packet number “i−1”; L(i−1) is the size (amount of data) of the packet having the packet number “i−1”; and r is the predetermined transmission speed (hereinafter referred to as shaping rate) of packets transmitted by the communication apparatus.
In step S43, the input processing unit 71 in the virtual device driver 53 determines whether the queue length Q is “0.” When the input processing unit 71 in the virtual device driver 53 determines in step S43 that the queue length Q is not “0,” the process proceeds to step S45.
On the other hand, when the input processing unit 71 in the virtual device driver 53 determines in step S43 that the queue length Q is “0,” the process proceeds to step S44, where the input processing unit 71 in the virtual device driver 53 determines whether the calculated transmission time Ti is later than a present time.
When the input processing unit 71 in the virtual device driver 53 determines in step S44 that the calculated transmission time Ti is later than the present time, the process proceeds to step S45, where the input processing unit 71 in the virtual device driver 53 sets the calculated transmission time Ti as the transmission time of the packet having the packet number “i.” The process is thereby ended.
When the input processing unit 71 in the virtual device driver 53 determines in step S44 that the calculated transmission time Ti is not later than the present time, the calculated transmission time Ti has already passed, and hence the process proceeds to step S46.
Also, when the input processing unit 71 in the virtual device driver 53 determines in step S41 that the packet number i of the packet supplied from the network layer 51 is “0,” the process proceeds to step S46, where the input processing unit 71 in the virtual device driver 53 sets the present time as the transmission time of the packet having the packet number “i.” The process is thereby ended.
A packet dequeueing process by the virtual device driver 53 will next be described with reference to a flowchart of FIG. 5.
Each time an interrupt signal to obtain a packet is supplied from the kernel timer 54 to the virtual device driver 53, the virtual device driver 53 calls a predetermined function, and performs the packet dequeueing process.
In step S61, the virtual device driver 53 sets a transmitted packet number. The transmitted packet number refers to the packet number of a last transmitted packet among packets transmitted in the physical layer 16-1 or the physical layer 16-2 to a terminal device as a transmission destination. In other words, the transmitted packet number refers to the largest number among the packet numbers of the packets transmitted in the physical layer 16-1 or the physical layer 16-2 to the terminal device as the transmission destination. In this case, no packet is transmitted yet, and therefore the virtual device driver 53 sets “0” as the transmitted packet number. Incidentally, when the transmitted packet number is “0,” it is indicated that there is no transmitted packet yet.
In step S62, the output processing unit 72 in the virtual device driver 53 determines whether an interrupt signal is supplied from the kernel timer 54. When the output processing unit 72 in the virtual device driver 53 determines in step S62 that no interrupt signal is supplied, the process of step S62 is repeated until an interrupt signal is supplied.
When the output processing unit 72 in the virtual device driver 53 determines in step S62 that an interrupt signal is supplied, the process proceeds to step S63, where the output processing unit 72 in the virtual device driver 53 determines whether a present time is later than the transmission time of a packet having a same packet number as the transmitted packet number. When the output processing unit 72 in the virtual device driver 53 determines in step S63 that the present time is later than the transmission time, the packet is transmitted. The process therefore proceeds to step S64, where the output processing unit 72 in the virtual device driver 53 dequeues the packet whose transmission time has arrived.
The dequeueing of the packet refers to a process of obtaining the packet stored in the buffer 55 and having the same packet number as the transmitted packet number, and supplying (outputting) the packet to the device driver 56-1 or the device driver 56-2. Specifically, in step S64, the output processing unit 72 in the virtual device driver 53 obtains the packet which is disposed at the head (exit side) of the FIFO queue and whose transmission time has arrived from the buffer 55, and supplies the obtained packet to the device driver 56-1 or the device driver 56-2.
In step S65, the output processing unit 72 in the virtual device driver 53 increments the transmitted packet number.
In step S66, the output processing unit 72 in the virtual device driver 53 decrements the queue length Q. The process then returns to step S62.
When the output processing unit 72 in the virtual device driver 53 determines in step S63 that the present time is not later than the transmission time, on the other hand, the packet is not transmitted. A return is therefore made to step S62 to repeat the above-described process.
Since the frequency of occurrence of timer events of the kernel timer 54 is normally 100 Hz, the kernel timer 54 supplies an interrupt signal to the virtual device driver 53 every 10 msec. The granularity of traffic shaping control is 10 msec.
For example, when a packet having a fixed packet size of 1 Kbyte is transmitted with a shaping rate of 10 Mbps, the communication apparatus transmits data of 100 Kbits each time the kernel timer 54 supplies an interrupt signal to the virtual device driver 53. That is, since data of 100 Kbits corresponds to about 12 packets having a packet size of 1 Kbyte, the communication apparatus performs burst transfer of 12 packets each time the kernel timer 54 supplies an interrupt signal to the virtual device driver 53.
In a High-resolution timer, traffic shaping is performed using an APIC (Advanced Programmable Interrupt Controller) on an Intel's Pentium (registered trademark) processor (see Luca Abeni, Ashvin Goel, Charles Krasic, Jim Snow and Jonathan Walpole, “A Measurement-Based Analysis of the Real-Time Performance of Linux,” IEEE RTAS 02, September, 2002). This APIC adjusts packet transmission intervals by making an OS generate a hardware interrupt after passage of an arbitrary time.
Further, there is a communication apparatus that performs traffic shaping by hardware in a communication network of an ATM (Asynchronous Transfer Mode) system.
Further, there is a communication apparatus in which a processor on a network card performs traffic shaping (see Japanese Patent Laid-Open Application No. 2001-211207, for example).
With the above-described techniques, however, it is not possible to control packet transmission intervals by software control without using special hardware for traffic shaping.
In addition, the control of packet transmission intervals by hardware imposes a heavy load on an OS, and is thus unsuitable for use with a high frequency.
Therefore, it is not possible to reduce delay fluctuations (jitter) in packet transmission, and realize data transmission with little delay.